﻿
<script>

export default {
  data() {
    return {
      user: {username: "张三"},
      auditUser:{},
      users:{},
    }
  },
  methods: {
  //   获取审核信息的方法
    findAllAudit(){
      this.axios.get(`http://localhost:8000/xm-client/xm-audit/findById?id=${this.$route.query.id}`).then(res=>{
      this.auditUser = res.data.data;
      this.findAllUser(res.data.data.uid)
    })
    },


  //    获取用户信息的方法
    findAllUser(id){
      this.axios.get(`http://localhost:8000/xm-client/xm-user/findById?id=${id}`).then(res=>{
        this.users = res.data.data;
      })
    },


  //   修改状态的方法
    submitForm(){
      if(this.auditUser.outcome=="同意"){
        this.auditUser.status=3;
      }else if (this.auditUser.outcome=="拒绝"){
        this.auditUser.status=4;
      }
      this.axios.post(`http://localhost:8000/xm-client/xm-audit/updateAudit`,this.auditUser).then(res=>{
        if(res.data.code==200){
          this.$message({
            message: '修改成功',
            type: 'success'
          });
        }

        this.axios.post(`http://localhost:8111/push/message2`,this.auditUser).then(res=>{
        })
        this.$router.push({path:'/user'});
      })
    },


  //   取消方法
    cancel(){
      this.$router.push({path:'/user'});
    },
  },

  created() {
    this.findAllAudit();
  },
  mounted() {
  }
}

</script>
<template>
  <div class="auditXq" style="width: 90%;">
    <h3 style="margin-top: 10px;margin-bottom: 10px"><i class="el-icon-document-copy" style="margin-right: 10px"></i>用户审核和详情
    </h3>
    <div style="display: flex;height: 170px;padding: 0.5%;background-color: #EFF2FC">
      <div style="width: 29%;padding-left: 80px">
        <img v-show="auditUser.status==1" src="https://spyx-yy.oss-cn-beijing.aliyuncs.com/2024/11/01/%E5%BE%85%E5%AE%A1%E6%A0%B8" height="155px">
        <img v-show="auditUser.status==2" src="https://spyx-yy.oss-cn-beijing.aliyuncs.com/2024/11/07/%E5%AE%A1%E6%A0%B8%E4%B8%AD" height="155px">
        <img v-show="auditUser.status==3" src="https://spyx-yy.oss-cn-beijing.aliyuncs.com/2024/11/07/%E5%AE%A1%E6%A0%B8%E9%80%9A%E8%BF%87" height="155px">
        <div v-show="auditUser.status==4" style="margin-top: 53px;margin-left: 40px">
          <font size="6px">审核未通过</font>
        </div>
      </div>
      <div style="width: 69%;padding-top: 15px">
        <div>
          <div style="display: grid;grid-template-columns: repeat(3, 1fr);height: 50px">
            <div>用户ID：{{ users.id }}</div>
            <div>电子邮箱：{{ users.electronicMailbox }}</div>
          </div>
        </div>
        <div style="display: grid; grid-template-columns: repeat(3, 1fr);height: 50px">
          <div>用户昵称：{{ users.name }}</div>
        </div>
           <div style="display: grid; grid-template-columns: repeat(3, 1fr);height: 50px">
          <div>手机号码：{{ users.mobilePhone}}</div>
        </div>
        </div>
      </div>



    <h4 style="margin-top: 20px">审核内容</h4>
    <div style="display: flex;margin-top: 10px;width: 100%; ">
      <div style="width: 32%;padding-top: 20px;margin-right:10px;padding-left: 20px">
        <p style="margin-bottom: 30px">流水号：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ auditUser.serialNumber }}</p>
        <p style="margin-bottom: 30px">审核类型：&nbsp;&nbsp;&nbsp;{{ auditUser.audit==1?'用户头像':'用户昵称' }}</p>
        <p v-show="auditUser.audit==2" style="margin-bottom: 30px">新信息：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{auditUser.newInformation }}</p>
        <p v-show="auditUser.audit==1" style="margin-bottom: 30px">新信息： <img :src="auditUser.newInformation" height="20px"></p>
        <p style="margin-bottom: 30px" v-show="auditUser.audit==2">旧信息：&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{{ auditUser.oldInformation }}</p>
        <p style="margin-bottom: 30px" v-show="auditUser.audit==1">旧信息：<img :src="auditUser.oldInformation" height="20px"></p>
        <p style="margin-bottom: 30px">提交时间：&nbsp;&nbsp;&nbsp;{{ auditUser.submissionTime }}</p>
      </div>
    </div>



    <div>
      <el-card  style="margin-top: 20px;border-color: white;box-shadow: none">
        <div slot="header" class="clearfix">
          <span>审核意见</span>
        </div>
        <el-form ref="form" :model="auditUser" label-width="120px">
          <el-form-item label="当前审核人：">
            <el-input v-model="user.username" style="width: 300px;" disabled></el-input>
          </el-form-item>
          <el-form-item label="审核结果：">
            <el-radio-group v-model="auditUser.outcome">
              <el-radio label="同意">同意</el-radio>
              <el-radio label="拒绝">拒绝</el-radio>
            </el-radio-group>
          </el-form-item>
          <el-form-item v-if="auditUser.outcome === '拒绝'" label="拒绝原因：">
            <el-select v-model="auditUser.refuse" placeholder="请选择原因">
              <el-option label="全部" value=""></el-option>
              <el-option label="原因1" value="1"></el-option>
              <el-option label="原因2" value="2"></el-option>
              <!-- 添加更多拒绝原因选项 -->
            </el-select>
          </el-form-item>
          <el-form-item label="补充说明：">
            <el-input style="width: 70%;" v-model="auditUser.supplement"
                      placeholder="请输入补充说明"></el-input>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="submitForm">确定</el-button>
            <el-button @click="cancel">取消</el-button>
          </el-form-item>
        </el-form>
      </el-card>
    </div>

    </div>

</template>


<style>


</style>
